package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.MenuDetailMapper;
import com.ruoyi.system.domain.MenuDetail;
import com.ruoyi.system.service.IMenuDetailService;

import javax.annotation.Resource;

/**
 * 菜谱详情Service业务层处理
 *
 * @author ruoyi
 * @date 2024-08-30
 */
@Service
public class MenuDetailServiceImpl implements IMenuDetailService {
    @Resource
    private MenuDetailMapper menuDetailMapper;

    /**
     * 查询菜谱详情
     *
     * @param id 菜谱详情主键
     * @return 菜谱详情
     */
    @Override
    public MenuDetail selectMenuDetailById(Long id) {
        return menuDetailMapper.selectMenuDetailById(id);
    }

    /**
     * 查询菜谱详情列表
     *
     * @param menuDetail 菜谱详情
     * @return 菜谱详情
     */
    @Override
    public List<MenuDetail> selectMenuDetailList(MenuDetail menuDetail) {
        return menuDetailMapper.selectMenuDetailList(menuDetail);
    }

    /**
     * 新增菜谱详情
     *
     * @param menuDetail 菜谱详情
     * @return 结果
     */
    @Override
    public int insertMenuDetail(MenuDetail menuDetail) {
        menuDetail.setCreateTime(DateUtils.getNowDate());
        return menuDetailMapper.insertMenuDetail(menuDetail);
    }

    /**
     * 修改菜谱详情
     *
     * @param menuDetail 菜谱详情
     * @return 结果
     */
    @Override
    public int updateMenuDetail(MenuDetail menuDetail) {
        menuDetail.setUpdateTime(DateUtils.getNowDate());
        return menuDetailMapper.updateMenuDetail(menuDetail);
    }

    /**
     * 批量删除菜谱详情
     *
     * @param ids 需要删除的菜谱详情主键
     * @return 结果
     */
    @Override
    public int deleteMenuDetailByIds(Long[] ids) {
        return menuDetailMapper.deleteMenuDetailByIds(ids);
    }

    /**
     * 删除菜谱详情信息
     *
     * @param id 菜谱详情主键
     * @return 结果
     */
    @Override
    public int deleteMenuDetailById(Long id) {
        return menuDetailMapper.deleteMenuDetailById(id);
    }
}
